{% extends "tasks/base.html" %}

{% load i18n %}
{% load uni_form %}
{% load group_tags %}

{% block head_title %}Add Task{% endblock %}

{% block body %}
    <h1>Add Task</h1>

    {% if is_member %}

         <div class="main-form">
            <form method="POST" action="" id="task_form" class="uniForm">
                <div class="form_block">
                    {{ task_form.media }}
                    {{ task_form|as_uni_form }}
                    <input type="submit" value="{% trans 'Add task' %}"/>
                    <input type="submit" name="add-another-task" value="{% trans 'Add task and add another' %}"/>
                </div>
            </form>
        </div>


    {% else %}
        <p>{% trans 'You are not a member and so cannot add a task.' %}</p>
    {% endif %}

{% endblock %}

{% block extra_body %}
    <script type="text/javascript">
        $().ready(function() {
            $('#id_search').after('<input type="submit" id="search_button" value="{% trans 'search' %}"/>')
            $('#id_search').click(function() {
                $('#id_search').val('');
            });
            $('#id_assignee').after(' <a href="#" onclick="$(\'#id_assignee\').val({{ user.id }}); return false;">{% trans "assign to me" %}</a>');
            $('#id_summary').focus();
        });
    </script>
{% endblock %}